<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-loanSetting-edit" th:object="${loanSetting}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
            <div class="form-group">	
                <label class="col-sm-3 control-label">最低贷款金额：</label>
                <div class="col-sm-8">
                    <input id="minTopLoan" name="minTopLoan" th:field="*{minTopLoan}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">最高贷款金额：</label>
                <div class="col-sm-8">
                    <input id="topLoan" name="topLoan" th:field="*{topLoan}" class="form-control" type="text">
                </div>
            </div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "beautyflower/loanSetting"
		$("#form-loanSetting-edit").validate({
			rules:{
                minTopLoan:{
                    required:true,
                    digits:true
                },
                topLoan:{
                    required:true,
                    digits:true
                },
			},
			submitHandler: function(form) {
			    if(Number($("#topLoan").val())<Number($("#minTopLoan").val())){
                    $.modal.msgWarning("最高借款不能小于最低借款");
                    return false;
                }
				$.operate.save(prefix + "/edit", $('#form-loanSetting-edit').serialize());
			}
		});
	</script>
</body>
</html>
